/*
 * To change this template, choose Tools | Templates and open the template in the editor.
 */

package cz.muni.fi.xkadlec6.bp.regularExpression;

import cz.muni.fi.xkadlec6.bp.automaton.Automaton;

/**
 * The class converts DFA to regular expression; regular expression to the NFA with epsilon-transitions
 * 
 * @author Jana Kadlecova
 */
public class RegularExpressionConverter
{

	/**
	 * Constructor is private, that make impossible to create the instances
	 */
	private RegularExpressionConverter()
	{
	}

	public static RegularExpression convertAutomatonToRegularExpression(Automaton automaton)
	{
		RegularGraph rg = new RegularGraph(automaton);
		return rg.reduct();
	}

	public static Automaton convertRegularExpressionToAutomaton(RegularExpression regularExpression)
	{
		RegularGraph rg = new RegularGraph(regularExpression);
		Automaton a = rg.transform();
		a.setIsNFA(true);
		return a;
	}

}
